\(\int \cot ^2(c+d x) \csc ^3(c+d x) (a+a \sin (c+d x))^2 \, dx\) [282]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 82 \[ \int \cot ^2(c+d x) \csc ^3(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {5 a^2 \text {arctanh}(\cos (c+d x))}{8 d}-\frac {2 a^2 \cot ^3(c+d x)}{3 d}-\frac {3 a^2 \cot (c+d x) \csc (c+d x)}{8 d}-\frac {a^2 \cot (c+d x) \csc ^3(c+d x)}{4 d} \]

[Out]

5/8*a^2*arctanh(cos(d*x+c))/d-2/3*a^2*cot(d*x+c)^3/d-3/8*a^2*cot(d*x+c)*csc(d*x+c)/d-1/4*a^2*cot(d*x+c)*csc(d*
x+c)^3/d

Rubi [A] (verified)

Time = 0.15 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {2952, 2691, 3855, 2687, 30, 3853} \[ \int \cot ^2(c+d x) \csc ^3(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {5 a^2 \text {arctanh}(\cos (c+d x))}{8 d}-\frac {2 a^2 \cot ^3(c+d x)}{3 d}-\frac {a^2 \cot (c+d x) \csc ^3(c+d x)}{4 d}-\frac {3 a^2 \cot (c+d x) \csc (c+d x)}{8 d} \]

[In]

Int[Cot[c + d*x]^2*Csc[c + d*x]^3*(a + a*Sin[c + d*x])^2,x]

[Out]

(5*a^2*ArcTanh[Cos[c + d*x]])/(8*d) - (2*a^2*Cot[c + d*x]^3)/(3*d) - (3*a^2*Cot[c + d*x]*Csc[c + d*x])/(8*d) -
 (a^2*Cot[c + d*x]*Csc[c + d*x]^3)/(4*d)

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2687

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[1/f, Subst[Int[(b*x)
^n*(1 + x^2)^(m/2 - 1), x], x, Tan[e + f*x]], x] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2] &&  !(IntegerQ[(n
- 1)/2] && LtQ[0, n, m - 1])

Rule 2691

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(a*Sec[e +
 f*x])^m*((b*Tan[e + f*x])^(n - 1)/(f*(m + n - 1))), x] - Dist[b^2*((n - 1)/(m + n - 1)), Int[(a*Sec[e + f*x])
^m*(b*Tan[e + f*x])^(n - 2), x], x] /; FreeQ[{a, b, e, f, m}, x] && GtQ[n, 1] && NeQ[m + n - 1, 0] && Integers
Q[2*m, 2*n]

Rule 2952

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) + (b_.)*sin[(e_.) + (f_.)*
(x_)])^(m_), x_Symbol] :> Int[ExpandTrig[(g*cos[e + f*x])^p, (d*sin[e + f*x])^n*(a + b*sin[e + f*x])^m, x], x]
 /; FreeQ[{a, b, d, e, f, g, n, p}, x] && EqQ[a^2 - b^2, 0] && IGtQ[m, 0]

Rule 3853

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Csc[c + d*x])^(n - 1)/(d*(n
- 1))), x] + Dist[b^2*((n - 2)/(n - 1)), Int[(b*Csc[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n,
 1] && IntegerQ[2*n]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \int \left (a^2 \cot ^2(c+d x) \csc (c+d x)+2 a^2 \cot ^2(c+d x) \csc ^2(c+d x)+a^2 \cot ^2(c+d x) \csc ^3(c+d x)\right ) \, dx \\ & = a^2 \int \cot ^2(c+d x) \csc (c+d x) \, dx+a^2 \int \cot ^2(c+d x) \csc ^3(c+d x) \, dx+\left (2 a^2\right ) \int \cot ^2(c+d x) \csc ^2(c+d x) \, dx \\ & = -\frac {a^2 \cot (c+d x) \csc (c+d x)}{2 d}-\frac {a^2 \cot (c+d x) \csc ^3(c+d x)}{4 d}-\frac {1}{4} a^2 \int \csc ^3(c+d x) \, dx-\frac {1}{2} a^2 \int \csc (c+d x) \, dx+\frac {\left (2 a^2\right ) \text {Subst}\left (\int x^2 \, dx,x,-\cot (c+d x)\right )}{d} \\ & = \frac {a^2 \text {arctanh}(\cos (c+d x))}{2 d}-\frac {2 a^2 \cot ^3(c+d x)}{3 d}-\frac {3 a^2 \cot (c+d x) \csc (c+d x)}{8 d}-\frac {a^2 \cot (c+d x) \csc ^3(c+d x)}{4 d}-\frac {1}{8} a^2 \int \csc (c+d x) \, dx \\ & = \frac {5 a^2 \text {arctanh}(\cos (c+d x))}{8 d}-\frac {2 a^2 \cot ^3(c+d x)}{3 d}-\frac {3 a^2 \cot (c+d x) \csc (c+d x)}{8 d}-\frac {a^2 \cot (c+d x) \csc ^3(c+d x)}{4 d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(209\) vs. \(2(82)=164\).

Time = 0.23 (sec) , antiderivative size = 209, normalized size of antiderivative = 2.55 \[ \int \cot ^2(c+d x) \csc ^3(c+d x) (a+a \sin (c+d x))^2 \, dx=a^2 \left (\frac {\cot \left (\frac {1}{2} (c+d x)\right )}{3 d}-\frac {3 \csc ^2\left (\frac {1}{2} (c+d x)\right )}{32 d}-\frac {\cot \left (\frac {1}{2} (c+d x)\right ) \csc ^2\left (\frac {1}{2} (c+d x)\right )}{12 d}-\frac {\csc ^4\left (\frac {1}{2} (c+d x)\right )}{64 d}+\frac {5 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{8 d}-\frac {5 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{8 d}+\frac {3 \sec ^2\left (\frac {1}{2} (c+d x)\right )}{32 d}+\frac {\sec ^4\left (\frac {1}{2} (c+d x)\right )}{64 d}-\frac {\tan \left (\frac {1}{2} (c+d x)\right )}{3 d}+\frac {\sec ^2\left (\frac {1}{2} (c+d x)\right ) \tan \left (\frac {1}{2} (c+d x)\right )}{12 d}\right ) \]

[In]

Integrate[Cot[c + d*x]^2*Csc[c + d*x]^3*(a + a*Sin[c + d*x])^2,x]

[Out]

a^2*(Cot[(c + d*x)/2]/(3*d) - (3*Csc[(c + d*x)/2]^2)/(32*d) - (Cot[(c + d*x)/2]*Csc[(c + d*x)/2]^2)/(12*d) - C
sc[(c + d*x)/2]^4/(64*d) + (5*Log[Cos[(c + d*x)/2]])/(8*d) - (5*Log[Sin[(c + d*x)/2]])/(8*d) + (3*Sec[(c + d*x
)/2]^2)/(32*d) + Sec[(c + d*x)/2]^4/(64*d) - Tan[(c + d*x)/2]/(3*d) + (Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2])/(1
2*d))

Maple [A] (verified)

Time = 0.31 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.46

method result size
parallelrisch \(-\frac {\left (\cot ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )-\left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {16 \left (\cot ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3}-\frac {16 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3}+8 \left (\cot ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-8 \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-16 \cot \left (\frac {d x}{2}+\frac {c}{2}\right )+16 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+40 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )\right ) a^{2}}{64 d}\) \(120\)
derivativedivides \(\frac {a^{2} \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )-\frac {2 a^{2} \left (\cos ^{3}\left (d x +c \right )\right )}{3 \sin \left (d x +c \right )^{3}}+a^{2} \left (-\frac {\cos ^{3}\left (d x +c \right )}{4 \sin \left (d x +c \right )^{4}}-\frac {\cos ^{3}\left (d x +c \right )}{8 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{8}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{8}\right )}{d}\) \(143\)
default \(\frac {a^{2} \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )-\frac {2 a^{2} \left (\cos ^{3}\left (d x +c \right )\right )}{3 \sin \left (d x +c \right )^{3}}+a^{2} \left (-\frac {\cos ^{3}\left (d x +c \right )}{4 \sin \left (d x +c \right )^{4}}-\frac {\cos ^{3}\left (d x +c \right )}{8 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{8}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{8}\right )}{d}\) \(143\)
risch \(\frac {a^{2} \left (9 \,{\mathrm e}^{7 i \left (d x +c \right )}-33 \,{\mathrm e}^{5 i \left (d x +c \right )}+48 i {\mathrm e}^{6 i \left (d x +c \right )}-33 \,{\mathrm e}^{3 i \left (d x +c \right )}-48 i {\mathrm e}^{4 i \left (d x +c \right )}+9 \,{\mathrm e}^{i \left (d x +c \right )}+16 i {\mathrm e}^{2 i \left (d x +c \right )}-16 i\right )}{12 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{4}}-\frac {5 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{8 d}+\frac {5 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{8 d}\) \(146\)
norman \(\frac {-\frac {a^{2}}{64 d}-\frac {a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{12 d}-\frac {5 a^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{32 d}+\frac {a^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {a^{2} \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}-\frac {a^{2} \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}-\frac {a^{2} \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {5 a^{2} \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{32 d}+\frac {a^{2} \left (\tan ^{11}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {a^{2} \left (\tan ^{12}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{64 d}-\frac {17 a^{2} \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{32 d}-\frac {17 a^{2} \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{32 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}-\frac {5 a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}\) \(263\)

[In]

int(cos(d*x+c)^2*csc(d*x+c)^5*(a+a*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

-1/64*(cot(1/2*d*x+1/2*c)^4-tan(1/2*d*x+1/2*c)^4+16/3*cot(1/2*d*x+1/2*c)^3-16/3*tan(1/2*d*x+1/2*c)^3+8*cot(1/2
*d*x+1/2*c)^2-8*tan(1/2*d*x+1/2*c)^2-16*cot(1/2*d*x+1/2*c)+16*tan(1/2*d*x+1/2*c)+40*ln(tan(1/2*d*x+1/2*c)))*a^
2/d

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 155 vs. \(2 (74) = 148\).

Time = 0.28 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.89 \[ \int \cot ^2(c+d x) \csc ^3(c+d x) (a+a \sin (c+d x))^2 \, dx=-\frac {32 \, a^{2} \cos \left (d x + c\right )^{3} \sin \left (d x + c\right ) - 18 \, a^{2} \cos \left (d x + c\right )^{3} + 30 \, a^{2} \cos \left (d x + c\right ) - 15 \, {\left (a^{2} \cos \left (d x + c\right )^{4} - 2 \, a^{2} \cos \left (d x + c\right )^{2} + a^{2}\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 15 \, {\left (a^{2} \cos \left (d x + c\right )^{4} - 2 \, a^{2} \cos \left (d x + c\right )^{2} + a^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{48 \, {\left (d \cos \left (d x + c\right )^{4} - 2 \, d \cos \left (d x + c\right )^{2} + d\right )}} \]

[In]

integrate(cos(d*x+c)^2*csc(d*x+c)^5*(a+a*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/48*(32*a^2*cos(d*x + c)^3*sin(d*x + c) - 18*a^2*cos(d*x + c)^3 + 30*a^2*cos(d*x + c) - 15*(a^2*cos(d*x + c)
^4 - 2*a^2*cos(d*x + c)^2 + a^2)*log(1/2*cos(d*x + c) + 1/2) + 15*(a^2*cos(d*x + c)^4 - 2*a^2*cos(d*x + c)^2 +
 a^2)*log(-1/2*cos(d*x + c) + 1/2))/(d*cos(d*x + c)^4 - 2*d*cos(d*x + c)^2 + d)

Sympy [F(-1)]

Timed out. \[ \int \cot ^2(c+d x) \csc ^3(c+d x) (a+a \sin (c+d x))^2 \, dx=\text {Timed out} \]

[In]

integrate(cos(d*x+c)**2*csc(d*x+c)**5*(a+a*sin(d*x+c))**2,x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 130, normalized size of antiderivative = 1.59 \[ \int \cot ^2(c+d x) \csc ^3(c+d x) (a+a \sin (c+d x))^2 \, dx=-\frac {3 \, a^{2} {\left (\frac {2 \, {\left (\cos \left (d x + c\right )^{3} + \cos \left (d x + c\right )\right )}}{\cos \left (d x + c\right )^{4} - 2 \, \cos \left (d x + c\right )^{2} + 1} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} - 12 \, a^{2} {\left (\frac {2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} + \log \left (\cos \left (d x + c\right ) + 1\right ) - \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + \frac {32 \, a^{2}}{\tan \left (d x + c\right )^{3}}}{48 \, d} \]

[In]

integrate(cos(d*x+c)^2*csc(d*x+c)^5*(a+a*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/48*(3*a^2*(2*(cos(d*x + c)^3 + cos(d*x + c))/(cos(d*x + c)^4 - 2*cos(d*x + c)^2 + 1) - log(cos(d*x + c) + 1
) + log(cos(d*x + c) - 1)) - 12*a^2*(2*cos(d*x + c)/(cos(d*x + c)^2 - 1) + log(cos(d*x + c) + 1) - log(cos(d*x
 + c) - 1)) + 32*a^2/tan(d*x + c)^3)/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 164 vs. \(2 (74) = 148\).

Time = 0.36 (sec) , antiderivative size = 164, normalized size of antiderivative = 2.00 \[ \int \cot ^2(c+d x) \csc ^3(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 16 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 24 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 120 \, a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - 48 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {250 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 48 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 24 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 16 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4}}}{192 \, d} \]

[In]

integrate(cos(d*x+c)^2*csc(d*x+c)^5*(a+a*sin(d*x+c))^2,x, algorithm="giac")

[Out]

1/192*(3*a^2*tan(1/2*d*x + 1/2*c)^4 + 16*a^2*tan(1/2*d*x + 1/2*c)^3 + 24*a^2*tan(1/2*d*x + 1/2*c)^2 - 120*a^2*
log(abs(tan(1/2*d*x + 1/2*c))) - 48*a^2*tan(1/2*d*x + 1/2*c) + (250*a^2*tan(1/2*d*x + 1/2*c)^4 + 48*a^2*tan(1/
2*d*x + 1/2*c)^3 - 24*a^2*tan(1/2*d*x + 1/2*c)^2 - 16*a^2*tan(1/2*d*x + 1/2*c) - 3*a^2)/tan(1/2*d*x + 1/2*c)^4
)/d

Mupad [B] (verification not implemented)

Time = 9.27 (sec) , antiderivative size = 161, normalized size of antiderivative = 1.96 \[ \int \cot ^2(c+d x) \csc ^3(c+d x) (a+a \sin (c+d x))^2 \, dx=\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{8\,d}+\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{12\,d}+\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4}{64\,d}-\frac {5\,a^2\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{8\,d}-\frac {{\mathrm {cot}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (-4\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+2\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+\frac {4\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{3}+\frac {a^2}{4}\right )}{16\,d}-\frac {a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{4\,d} \]

[In]

int((cos(c + d*x)^2*(a + a*sin(c + d*x))^2)/sin(c + d*x)^5,x)

[Out]

(a^2*tan(c/2 + (d*x)/2)^2)/(8*d) + (a^2*tan(c/2 + (d*x)/2)^3)/(12*d) + (a^2*tan(c/2 + (d*x)/2)^4)/(64*d) - (5*
a^2*log(tan(c/2 + (d*x)/2)))/(8*d) - (cot(c/2 + (d*x)/2)^4*(2*a^2*tan(c/2 + (d*x)/2)^2 - 4*a^2*tan(c/2 + (d*x)
/2)^3 + a^2/4 + (4*a^2*tan(c/2 + (d*x)/2))/3))/(16*d) - (a^2*tan(c/2 + (d*x)/2))/(4*d)